import request from '@/config/axios'

export interface domainManageVO {
  id: number
  name: string
  status: number
  createTime: Date
  domain: string
  type: number
}

export interface UpdateStatusReqVO {
  id: number
  status: number
}

// 创建客服链接配置
export const createDomainManage = async (data) => {
  return await request.post({
    url: '/promotion/domain-manage/create',
    data: data
  })
}

// 更新客服链接配置
export const updateDomainManage = async (data) => {
  return await request.put({
    url: '/promotion/domain-manage/update',
    data: data
  })
}

// 删除客服链接配置
export const deleteDomainManage = async (id) => {
  return request.get({
    url: '/promotion/domain-manage/delete?id=' + id,
    method: 'delete'
  })
}

// 获得客服链接配置
export const getDomainManage = async (id) => {
  return request.get({
    url: '/promotion/domain-manage/get?id=' + id,
    method: 'get'
  })
}

// 获得客服链接配置分页
export const getDomainManagePage = async (query) => {
  return request.get({
    url: '/promotion/domain-manage/page',
    method: 'get',
    params: query
  })
}

// 导出客服链接配置 Excel
export const exportDomainManageExcel = async (query) => {
  return request.get({
    url: '/promotion/domain-manage/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 关闭客服链接
export const closeDomainManage = async (id: number) => {
  return await request.put({ url: '/promotion/domain-manage/close?id=' + id })
}
